/*
 * myradio.h
 *
 *  Created on: 2013.04.27.
 *      Author: Gábor
 */

#ifndef MYRADIO_H_
#define MYRADIO_H_

#include "bsp.h"

#define RADIO_CTS_TIMEOUT 5000

/*! Maximal packet length definition (FIFO size) */
#define RADIO_MAX_PACKET_LENGTH     64

extern U8 fixRadioPacket[RADIO_MAX_PACKET_LENGTH];

enum
{
    SI446X_SUCCESS,
    SI446X_NO_PATCH,
    SI446X_CTS_TIMEOUT,
    SI446X_PATCH_FAIL,
    SI446X_COMMAND_ERROR
};

void radio_HW_powerUp(void);
U8 PollCTS(void);

U8 si446x_configuration_init(U8 numOfBytes, U8* pSetPropCmd);

U8 radio_comm_GetResp(U8 byteCount, U8* pData);
void radio_comm_SendCmd(U8 byteCount, U8* pData);
U8 radio_comm_SendCmdGetResp(U8 cmdByteCount, U8* pCmdData, U8 respByteCount, U8* pRespData);

void radio_comm_WriteData(U8 cmd, bool pollCts, U8 byteCount, U8* pData);

bool gRadio_CheckTransmitted(void);

#endif /* MYRADIO_H_ */
